<!-- /* Description for file.
 * 企业阶段定制
 * @copyright     Copyright 2008-2010, PHInfo Services Inc. (http://www.phinfoservices.com)
 * @package       ues
 * @subpackage    ues/app/views/competencyphases
 * @since         ues
 * @version       V0.0.1
 * @modifiedby    张海杰2011年0618
 * @lastmodified  张海杰2011年0618
 */
 -->
 <?php
echo $html->css ( 'tab' );
echo $html->css ( 'jquery-validate/css/screen' );

?>
<script type="text/javascript">
//Form验证
$(document).ready(function() {
	 $.validator.setDefaults({       
		 submitHandler: function(form) {    
		  form.submit();    
		}       
	});
});
</script>
<script type="text/javascript">
	function getDelStr() {
		var delArr = $("#CompetencyphaseCompetencyphasesDelForm :checkbox:checked");
		if(delArr.length==0)
		{
			alert("请选择你要删除的项!");
			return;
		}
		var str = "";
		for(var i=0;i<delArr.length;i++) {
			var del = delArr[i].value;
			str += del;
			str += "/";
		}
		$("#delStr").val(str);
		$("#CompetencyphaseCompetencyphasesDelForm").submit();
	}

	$(document).ready(function(){ 	
		$(":checkbox").click(function(){
			if($("#CompetencyphaseCompetencyphasesDelForm :checkbox:checked").attr("checked")==true){ 
				$('#CompetencyphaseField1').val(' ');
	    		var rl=$("#CompetencyphaseCompetencyphasesDelForm :checkbox:checked").next().text();
	    		$('#CompetencyphaseField1').val(rl);
	    		//alert(rl);
	        }
	 	});		
		$("#btnajaxAdd").click(function(){
			var n=$("#CompetencyphaseField1").val();
			$("#CompetencyphaseName").val(n);
			//alert($("#CompetencyphaseName").val());
			// validate signup form on keyup and submit
				$("#CompetencyphaseCompetencyphasesAddForm").validate({
					rules: {
					"data[Competencyphase][name]":{
							required: true,alowsome: true,stringMinLength:0,stringMaxLength:20
						}
					},
					messages: {
						name:{
						required:  "请输入企业阶段名称"
							
						}
					},
					//设置验证触发事件 
					focusInvalid: false, 
					onkeyup: false, 
					//设置错误信息提示DOM  
					errorPlacement: function(error, element) { 
					error.appendTo( element.parent()); 
					}
				});
				$("#CompetencyphaseCompetencyphasesAddForm").submit();
			});
		$("#btnajaxEdit").click(function(){
			if($(":checkbox[checked=true]").length==0)
			{
				alert("请选择");
			}
			else if($(":checkbox[checked=true]").length>1)
			{
				alert("请选择1个");
			}
			else
			{
				var id=$(":checkbox[checked=true]").val();
				$("#id").val(id);

				var n=$("#CompetencyphaseField1").val();
				$("#name1").val(n);
			//alert($("#CompetencyphaseName").val());
			// validate signup form on keyup and submit
				$("#CompetencyphaseEditForm").validate({
					rules: {
					"data[Competencyphase][name]":{
							required: true,alowsome: true,stringMinLength:0,stringMaxLength:20
						}
					},
					messages: {
						name:{
						required:  "请输入企业阶段名称"
							
						}
					},
					//设置验证触发事件 
					focusInvalid: false, 
					onkeyup: false, 
					//设置错误信息提示DOM  
					errorPlacement: function(error, element) { 
					error.appendTo( element.parent()); 
					}
				});
				$("#CompetencyphaseEditForm").submit();
		};	
		
	});

	});
</script>


<!-- 当前位置-->
<div id="tabmenubar">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td class="tabmenubartitle1"><?php echo  __('YourPosition');//您现在的位置：?></td>
		<td class="tabmenubartitle2"><?php echo __('Systemconfigs');//一级目录
										   echo '>';echo __('Resumesetting');//二级目录
										   echo '>';?>
									<?php echo $html->tag('span', __('Competencyphases Set',true));//当前操作地用span加粗?> 						  
		</td>
	</tr>
</table>
</div>
<!-- 当前位置-->
<?php echo $form->create('Competencyphase',array('action'=>'competencyphasesAdd','type'=> 'post'));?>
<?php echo $form->hidden('name'); ?>
<?php echo $form->end();?>
<?php echo $form->create('Competencyphase',array('action'=>'edit','type'=> 'post'));?>
<?php echo $form->hidden('id',array('id'=>'id')); ?>
<?php echo $form->hidden('name',array('id'=>'name1')); ?>
<?php echo $form->end();?>

<?php echo $form->create('Competencyphase',array('action'=>'competencyphasesDel','type'=> 'post'));?>
<?php echo $form->hidden('delStr',array('name'=>'competencyphaseid','id'=>'delStr'));?>

<!-- 企业阶段定制列表 -->
<div id="nav1" style="width:65%">
<table width="100%" cellpadding="0" cellspacing="0" class="tab1">
	<tr>
		<th width="70px"><?php echo __('Selected');?></th>
		<th ><?php echo __('CompetencyphasesName');?></th>
		
	</tr>
	<!-- Here's where we loop through our $Notes array, printing out post info --> 
	
	<?php 
	foreach ($toplist as $competencyphases): 
	?>
		<tr class=normal onmouseover='this.className= "over " '
			onmouseup='this.className= "over " '
			onmouseout='this.className= "normal " '>
			<td>
<!-- 批量删除选择 -->				
				<?php echo $form->checkbox($competencyphases['Competencyphase']['id'], array('value' => $competencyphases['Competencyphase']['id']));?>
				<h2 style="display:none"><?php echo  $competencyphases['Competencyphase']['name']; ?></h2>
			</td>
			<td class="editname"><?php echo $competencyphases['Competencyphase']['name']; ?></td>
			
		</tr> 
	<?php endforeach; ?>
</table>
</div>
<!-- 企业阶段定制列表 -->
<div id="nav1" style="width:28%">
<fieldset><legend><?php __('Competencyphases Add');?></legend>
		<table width="98%" cellspacing="0" cellpadding="0" border="0" >
			<tr>
				<td width="80px"><span id="Label3" class="searchcharstyle"><?php __('CompetencyphasesName'); ?></span><font color="red">*</font>
				</td>
				<td >
					<?php echo $form->text('Field1',array('class' => 'TextBoxE1')); ?>
				</td>
				<td width="20px">
					<a><?php echo $html->image('add.gif', array('alt' =>  __('Add', true),'border'=>'0','id'=>'btnajaxAdd'));?> </a>
					 <!--添加 -->
				</td>
				<td width="20px">
				<a><?php echo $html->image('edit.gif', array('alt' =>  __('Edit', true),'border'=>'0','id'=>'btnajaxEdit'));?> </a>
				</td>
				<td width="20px">
				<a><?php echo $html->image('delete.gif', array('alt' =>  __('Delete', true),'border'=>'0','onclick'=>'getDelStr()'));?> </a>
					 <!--删除 --></td>
			</tr>
			</table>
</fieldset>
</div>
<?php echo $form->end();?>
